﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace B.Z.Inventory.Infrastructure.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "仓库表",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    StoreName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CreateUserId = table.Column<int>(type: "int", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateUserId = table.Column<int>(type: "int", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_仓库表", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "出入库单",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    InventoryId = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    InStoreNo = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    GoodsIds = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IntOutStoreTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    StoreId = table.Column<int>(type: "int", nullable: false),
                    Count = table.Column<int>(type: "int", nullable: false),
                    Reson = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsIntOrOut = table.Column<bool>(type: "bit", nullable: false),
                    AttnId = table.Column<int>(type: "int", nullable: false),
                    AttnName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CreateUserName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CreateUserId = table.Column<int>(type: "int", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateUserId = table.Column<int>(type: "int", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_出入库单", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "货品表",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GoodsName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    GoodsNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    GoodsModel = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    GoodsUnit = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SystemNum = table.Column<int>(type: "int", nullable: true),
                    ActualNum = table.Column<int>(type: "int", nullable: true),
                    DifferentCount = table.Column<int>(type: "int", nullable: true),
                    OnePrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    MinStockLevel = table.Column<int>(type: "int", nullable: true),
                    SafeStockLevel = table.Column<int>(type: "int", nullable: true),
                    MaxStockLevel = table.Column<int>(type: "int", nullable: true),
                    CreateUserId = table.Column<int>(type: "int", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateUserId = table.Column<int>(type: "int", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_货品表", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "库存货品中间表",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    InventoryId = table.Column<int>(type: "int", nullable: false),
                    GoodsId = table.Column<int>(type: "int", nullable: false),
                    CreateUserId = table.Column<int>(type: "int", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateUserId = table.Column<int>(type: "int", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_库存货品中间表", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "库存盘点表",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    InventoryNnumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    InventoryStatus = table.Column<int>(type: "int", nullable: false),
                    Mid = table.Column<int>(type: "int", nullable: false),
                    InventoryType = table.Column<int>(type: "int", nullable: false),
                    StoreId = table.Column<int>(type: "int", nullable: false),
                    InventoryRange = table.Column<int>(type: "int", nullable: false),
                    InventoryStartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    InventoryEndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Note = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TaskType = table.Column<int>(type: "int", nullable: false),
                    AttnId = table.Column<int>(type: "int", nullable: false),
                    AttnName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CreateUserName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IsHaveGoods = table.Column<bool>(type: "bit", nullable: false),
                    CreateUserId = table.Column<int>(type: "int", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdateUserId = table.Column<int>(type: "int", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_库存盘点表", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "仓库表");

            migrationBuilder.DropTable(
                name: "出入库单");

            migrationBuilder.DropTable(
                name: "货品表");

            migrationBuilder.DropTable(
                name: "库存货品中间表");

            migrationBuilder.DropTable(
                name: "库存盘点表");
        }
    }
}
